package com.gitee.wsl.time.chinese

import kotlinx.datetime.LocalDate
import kotlin.test.Test
import kotlin.test.assertEquals


class SolarTermTest {
    
    val termTest1: Unit
        get() {
            val term: Int = SolarTerm.getTerm(1987, 3)
            assertEquals(4, term)
        }

    
    val termTest: Unit
        get() {
            assertEquals("小寒", SolarTerm.getTerm(2021, 1, 5))

            assertEquals("大寒", SolarTerm.getTerm(2021, 1, 20))

            assertEquals("立春", SolarTerm.getTerm(2021, 2, 3))

            assertEquals("雨水", SolarTerm.getTerm(2021, 2, 18))

            assertEquals("惊蛰", SolarTerm.getTerm(2021, 3, 5))

            assertEquals("春分", SolarTerm.getTerm(2021, 3, 20))

            assertEquals("清明", SolarTerm.getTerm(2021, 4, 4))

            assertEquals("谷雨", SolarTerm.getTerm(2021, 4, 20))

            assertEquals("立夏", SolarTerm.getTerm(2021, 5, 5))

            assertEquals("小满", SolarTerm.getTerm(2021, 5, 21))

            assertEquals("芒种", SolarTerm.getTerm(2021, 6, 5))

            assertEquals("夏至", SolarTerm.getTerm(2021, 6, 21))

            assertEquals("小暑", SolarTerm.getTerm(2021, 7, 7))

            assertEquals("大暑", SolarTerm.getTerm(2021, 7, 22))

            assertEquals("立秋", SolarTerm.getTerm(2021, 8, 7))

            assertEquals("处暑", SolarTerm.getTerm(2021, 8, 23))

            assertEquals("白露", SolarTerm.getTerm(2021, 9, 7))

            assertEquals("秋分", SolarTerm.getTerm(2021, 9, 23))

            assertEquals("寒露", SolarTerm.getTerm(2021, 10, 8))

            assertEquals("霜降", SolarTerm.getTerm(2021, 10, 23))

            assertEquals("立冬", SolarTerm.getTerm(2021, 11, 7))

            assertEquals("小雪", SolarTerm.getTerm(2021, 11, 22))

            assertEquals("大雪", SolarTerm.getTerm(2021, 12, 7))

            assertEquals("冬至", SolarTerm.getTerm(2021, 12, 21))
        }


    
    val termByDateTest: Unit
        get() {
            assertEquals("春分", SolarTerm.getTerm(LocalDate.parse("2021-03-20")))
            assertEquals("处暑", SolarTerm.getTerm(LocalDate.parse("2022-08-23")))
        }


    
    val termByChineseDateTest: Unit
        get() {
            assertEquals("清明", SolarTerm.getTerm(ChineseDate(2021, 2, 23)))
            assertEquals("秋分", SolarTerm.getTerm(ChineseDate(2022, 8, 28)))
        }
}
